#!/bin/sh

target=sites/x6-sites/static/apps

er_repo=examples/x6-app-er
dag_repo=examples/x6-app-dag
draw_repo=examples/x6-app-draw
svg2shape_repo=sites/x6-svg-to-shape

er_dist=$target/er
dag_dist=$target/dag
draw_dist=$target/draw
svg2shape_dist=$target/svg-to-shape

(cd $er_repo && yarn build)
rm -rf $er_dist && mkdir -p $er_dist && cp -rv $er_repo/dist/* $er_dist

(cd $dag_repo && yarn build)
rm -rf $dag_dist && mkdir -p $dag_dist && cp -rv $dag_repo/dist/* $dag_dist

(cd $draw_repo && yarn build)
rm -rf $draw_dist && mkdir -p $draw_dist && cp -rv $draw_repo/dist/* $draw_dist

(cd $svg2shape_repo && yarn build)
rm -rf $svg2shape_dist && mkdir -p $svg2shape_dist && cp -rv $svg2shape_repo/dist/* $svg2shape_dist
